class code4 {

    public boolean containsDuplicate(int[] nums) {
        Set<Integer> hash = new HashSet<>();
        for(int x:nums) {
            if(hash.contains(x)) return true;
            hash.add(x);
        }
        return false;
    }
}